import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BrokerageRecordVo, BrokerageRecordForm, BrokerageRecordQuery } from '@/api/brokerage/record/types';

/**
 * 查询佣金记录列表
 * @param query
 * @returns {*}
 */

export const listBrokerageRecord = (query?: BrokerageRecordQuery): AxiosPromise<BrokerageRecordVo[]> => {
  return request({
    url: '/lawyer/brokerageRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询佣金记录详细
 * @param id
 */
export const getBrokerageRecord = (id: string | number): AxiosPromise<BrokerageRecordVo> => {
  return request({
    url: '/lawyer/brokerageRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增佣金记录
 * @param data
 */
export const addBrokerageRecord = (data: BrokerageRecordForm) => {
  return request({
    url: '/lawyer/brokerageRecord/saveBrokerageRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改佣金记录
 * @param data
 */
export const updateBrokerageRecord = (data: BrokerageRecordForm) => {
  return request({
    url: '/lawyer/brokerageRecord/updateBrokerageRecord',
    method: 'post',
    data: data
  });
};

/**
 * 删除佣金记录
 * @param id
 */
export const delBrokerageRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/lawyer/brokerageRecord/removeBrokerageRecord/' + id,
    method: 'delete'
  });
};
